package com.wyl.controller

import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

@Controller
class ModelTest1 {
    @RequestMapping("/m1/t1")
    fun test1(req: HttpServletRequest, resp: HttpServletResponse): String {
//        println(req.session.id)
        //逗着玩的写法
//        req.getRequestDispatcher("").forward(req, resp) //转发
//        resp.sendRedirect("")   //重定向
        return "test" //转发
    }

    @RequestMapping("/m1/t2")
    fun test2(): String {
        //http://localhost:8080/m1/index.jsp 这里会失败 不知道怎么搞
        return "redirect:index.jsp" //重定向
    }
}